<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/7/2 14:07
 * Modified Time: 2019/7/2 14:07
 * Version: 2.0
 */

namespace App\Modules\Inventory\Validators;


use Flower\Core\Repository\Contracts\ValidatorInterface;
use Flower\Core\Repository\Validator\LaravelValidator;

class GoodsCategoryValidator extends LaravelValidator
{
    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'store_id' => 'required|numeric',
            'parent_id' => 'required|numeric',
            'name' => 'required|between:2,8'
        ],
        ValidatorInterface::RULE_UPDATE => [
            'parent_id' => 'filled|numeric',
            'name' => 'filled|between:2,8'
        ]
    ];
    protected $messages = [
        'store_id.required' => '缺少店铺id',
        'store_id.numeric' => '店铺id格式错误',

        'name.required' => '请填写分类名',                'name.filled' => '请填写分类名',
        'name.between' => '分类名应在2-8个字符之间',


        'parent_id' => '请选择分类',
        'parent_id' => 'parent_id格式错误',

    ];
}